﻿using System.Text.RegularExpressions;

namespace Tools.Utilities
{
    public static class HtmlCleaner
    {
        public static string ReplaceDiv(string inputString)
        {
            inputString = TagReplacer.ReplaceCenteredDivs(inputString);

            inputString = Regex.Replace(inputString, "<div>&nbsp;", string.Empty)
                .Replace("<div>[\r\n]*", string.Empty)
                .Replace("<div.*?>", string.Empty)
                .Replace("</div>", "<br>");

            inputString = Regex.Replace(inputString, "(<br>[\r\n]*)*$", string.Empty);

            return inputString;
        }
    }
}
